package com.wwu.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wwu.common.constant.CommConst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 系统操作日志实体
 * @author 一蓑烟雨
 * @date 2023/5/31 9:35
 */
@Data
@Accessors(chain = true)
@TableName("sys_oper_log")
@ApiModel(value="SysOperLog:系统操作日志实体", description="系统操作日志实体")
public class OperLog implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "日志id")
    @TableId(value = "record_id", type = IdType.ASSIGN_ID)
    private String recordId;

    @ApiModelProperty(value = "会话id")
    @TableField(value = "session_id")
    private String sessionId;

    @ApiModelProperty(value = "登陆名")
    @TableField("user_name")
    private String userName;

    @ApiModelProperty(value = "操作模块")
    @TableField("oper_module")
    private String operModule;

    @ApiModelProperty(value = "操作类型")
    @TableField("oper_type")
    private String operType;

    @ApiModelProperty(value = "请求地址")
    @TableField("request_url")
    private String requestUrl;

    @ApiModelProperty(value = "请求方式")
    @TableField("request_method")
    private String requestMethod;

    @ApiModelProperty(value = "请求方法")
    @TableField("request_class")
    private String requestClass;

    @ApiModelProperty(value = "请求参数")
    @TableField("request_param")
    private String requestParam;

    @ApiModelProperty(value = "响应结果")
    @TableField("response_result")
    private String responseResult;


    @ApiModelProperty(value = "浏览器")
    @TableField("browser")
    private String browser;

    @ApiModelProperty(value = "操作系统")
    @TableField("os")
    private String os;

    @ApiModelProperty(value = "操作者IP地址")
    @TableField("oper_ip")
    private String operIp;

    @ApiModelProperty(value = "操作者主机名")
    @TableField("oper_remote_host")
    private String operRemoteHost;

    @ApiModelProperty(value = "操作者位置")
    @TableField("oper_location")
    private String operLocation;

    @ApiModelProperty(value = "操作状态(0:成功；1:失败)）")
    @TableField("oper_status")
    private Integer operStatus;

    @ApiModelProperty(value = "操作信息描述")
    @TableField("oper_desc")
    private String operDesc;

    @ApiModelProperty(value = "操作开始时间")
    /** 格式化后台和前端显示样式 */
    @DateTimeFormat(pattern = CommConst.DATE_TIME)
    @JsonFormat(pattern = CommConst.DATE_TIME,timezone = CommConst.TIME_ZONE)
    @TableField(value = "oper_start_time")
    private LocalDateTime operStartTime;

    @ApiModelProperty(value = "操作结束时间")
    /** 格式化后台和前端显示样式 */
    @DateTimeFormat(pattern = CommConst.DATE_TIME)
    @JsonFormat(pattern = CommConst.DATE_TIME,timezone = CommConst.TIME_ZONE)
    @TableField(value = "oper_end_time")
    private LocalDateTime operEndTime;

    @ApiModelProperty(value = "操作时长(单位:秒)")
    @TableField(value = "oper_execute_duration")
    private Long operExecuteDuration;
}
